home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ALetter.h
-
- Contains: xxx put contents here xxx
-
- Written by: Tim Harnett
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <15> 2/27/95 TMH adapt to use ETO16 universal headers
- <13> 2/10/95 TMH change wireless to HFS
- <10> 1/11/95 TMH added nested letter functions, and tweak to generalize framework
- <9> 12/12/94 TMH added constructorIOutgoingALetter(TMSAMSlot* slot, long
- letterSeqNo)
- <8> 12/2/94 TMH added ::LetterID()
- <5> 10/27/94 JHB Add functionality for support of Tmailhandler
- <4> 10/14/94 TMH added PutRecipient(StringPtr ..) method
- <3> 10/3/94 TMH break of TWireless&TEWorld from TExternalSlot
- <2> 9/30/94 TMH stuff to write the To: recipients
- <1> 9/20/94 TMH Abandon RoadsideRest embrace Mercury
- 9/1/94 TMH xxx put comment here xxx
-
- To Do:
- */
-
- #ifndef __ALetter__
- #define __ALetter__
-
- class TIncomingXLetter;
- class TMSAMSlot;
- class CDSSpec;
-
- #ifndef __TAOCEEnclosure__
- #include "AOCEEnclosure.h"
- #endif
-
- #ifndef __Letter__
- #include "Letter.h"
- #endif
-
- #ifndef __MEMORY__
- #include "Memory.h"
- #endif
-
- #ifndef __FILES__
- #include "Files.h"
- #endif
-
- #ifndef __STRINGS__
- #include "Strings.h"
- #endif
-
-
- //---------------------------------
- // MSAM Utilities ••• put in a object?
- //---------------------------------
-
- OSErr OpenNested(MailMsgRef parentMsgRef,MailMsgRef& nestedMsgRef);
- MailNestingLevel GetNestingLevel(MailMsgRef nestedMsgRef);
- void GetSubject(MailMsgRef nestedMsgRef,CRString32& subject);
-
-
- //--------------------------------------
- // T A L e t t e r
- //--------------------------------------
-
- class TALetter : public TLetter {
- public:
- TALetter();
- void IALetter(TMSAMSlot* msamSlot);
-
-
- // Accessors
- MailIndications GetMailIndications() { return fIndications; };
- MailMsgRef MsgRef() { return fMsgRef; }
-
- MailLetterID LetterID() { return fLetterID; };
- MailNestingLevel NestingLevel() { return fNestingLevel; };
-
- Boolean HasNestedLetters() { return fNestingLevel != 0; }
- Boolean IsOpen() { return fMsgRef != 0; }
-
- void EnumEnclosures();
-
- Boolean HasEnclosure();
-
- TAOCEEnclosure* fAOCEEnclosure;
-
-
- protected:
- MailMsgRef fMsgRef;
- long fSeqNum;
-
- MailIndications fIndications;
-
- Boolean fHasEnclosure;
-
- MailNestingLevel fNestingLevel;
- MailLetterFlags fLetterFlags;
- OCECreatorType fCreatorType;
- OSType fMsgFamily;
- MailLetterID fLetterID;
- MailLetterID fReplyID;
- MailLetterID fConversationID;
- MailTime fMailTime;
-
-
- };
-
-
- //--------------------------------------
- // T I n c o m i n g A L e t t e r
- //--------------------------------------
-
- // We create this letter from an external system letter.
-
- class TIncomingALetter : public TALetter {
- public:
- TIncomingALetter();
- ~TIncomingALetter();
-
- void IIncomingALetter(TMSAMSlot* slot,TIncomingXLetter* incomingXLetter);
- void IIncomingALetter(TMSAMSlot* slot, char* subject,char* fromRecipient);
- void IIncomingALetter(TMSAMSlot* slot, StringPtr subject, StringPtr fromRecipient);
- void IIncomingALetter(TMSAMSlot* slot, MailTime* sendTime, char* subject,char* fromRecipient);
- void IIncomingALetter(TMSAMSlot* slot, MailTime* sendTime, StringPtr subject, StringPtr fromRecipient);
-
-
- virtual void SetHeaderInfo(); // set from the incoming XLetter.
-
-
- OSErr CreateInTraySummary();
- OSErr CreateInTraySummary(MailTime* letterTimeStamp);
- OSErr Create();
- OSErr Submit();
-
- void DeliveryDone();
-
- OSErr PutRecipient(CDSSpec& recipient,MailAttributeID recipientKind);
- OSErr PutRecipient(StringPtr addr,MailAttributeID recipientKind);
-
- OSErr WriteLetterHeader();
- OSErr WriteLetterHeader(StringPtr theFromRecip);
- OSErr WriteHeaderSubject();
- OSErr WriteHeaderMailIndications();
- OSErr WriteHeaderSendTime();
-
-
- // Letter Content
- OSErr WriteBody();
-
- OSErr WriteTextContent(void* textBuf,long lengthOfText);
- OSErr WriteStyleTextContent(void* textBuf,long lengthOfText, StScrpRec *styleRec, Boolean appendText);
-
- OSErr WriteEnclosure(FSSpec* enclosureFSSpec);
-
-
- private:
- TIncomingXLetter* fIncomingXLetter;
- };
-
-
-
-
- //--------------------------------------
- // T O u t g o i n g A L e t t e r
- //--------------------------------------
-
-
- class TOutgoingALetter : public TALetter {
- public:
- friend class CContentReader;
-
- TOutgoingALetter();
- ~TOutgoingALetter();
- void IOutgoingALetter(TMSAMSlot* slot, MSAMEnumerateOutQReply* outQEnumReply);
- void IOutgoingALetter(TMSAMSlot* slot, long letterSeqNo);
-
- MailMsgRef GetNestedContentMsgRef();
-
- Boolean HasText() { return fHasText; }
- Boolean HasStyledText() { return fHasStyledText; }
- Boolean HasSound() { return fHasSound; }
- Boolean HasMovie() { return fHasMovie; }
- Boolean HasPict() { return fHasPict; }
- Boolean HasContent() { return fHasText | fHasSound | fHasMovie | fHasPict; }
-
- long TextLength() { return fTextLength; }
- long StyledTextLength() { return fStyledTextLength; }
- long SoundLength() { return fSoundLength; }
- long MovieLength() { return fMovieLength; }
- long PictLength() { return fPictLength; }
- long ContentLength() { return fTextLength+fSoundLength+fMovieLength+fPictLength; }
-
-
- // The following methods are candidates to promote up to TALetter
- // but today 9/2/94 only these are operations done only on outgoing letters.
-
- OSErr Open();
- void OpenForSending();
-
-
- OSErr Close();
- void CloseSending(OSErr osErr = noErr);
-
-
- OSErr SetStatus(PMSAMStatus newStatus);
- OSErr ReadLetterAttributes();
- OSErr InventoryLetterContents();
-
- Boolean NeedsDeliveryReport() { return ((long)*(long*)&fIndications & kMailReceiptReportsMask ) || ((long)*(long*)&fIndications & kMailNonReceiptReportsMask); };
- void DeliveryReport(OSErr deliverErr=0);
-
- void MarkRejectedRecipient(StringPtr recipient);
- void MarkResolvedRecipients();
- OSErr MarkRecipient(short recipIndex);
-
- private:
-
- Boolean fHasText;
- Boolean fHasStyledText;
- Boolean fHasSound;
- Boolean fHasMovie;
- Boolean fHasPict;
-
- long fTextLength;
- long fStyledTextLength;
- long fSoundLength;
- long fMovieLength;
- long fPictLength;
-
- long fNTextSegments;
- long fNStyledTextSegments;
- long fNSoundSegments;
- long fNMovieSegments;
- long fNPictSegments;
-
- };
-
-
-
- //----------------------------------------------
- // C N e s t e d L e t t e r I t e r a t o r
- //---------------------------------------------
-
- class CNestedLetterIterator {
-
- public:
- CNestedLetterIterator(MailMsgRef parentMsgRef);
- MailMsgRef FirstNestedLetter();
- Boolean More();
- MailMsgRef NextNestedLetter();
- private:
-
- MailMsgRef fEnvelopMsgRef;
- MailMsgRef fParentMsgRef;
- MailMsgRef fNestedMsgRef;
-
- };
-
-
-
-
- #endif
-